package com.youedata.modular.enums;

public enum ToClassFlag {

    /**
     * 枚举到课状态
     */
    Normal("1", "正常"),
    Late("2", "迟到早退"),
    Truanc("3","旷课");

    private String code;
    private String desc;

    ToClassFlag(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static ToClassFlag getByCode(String code) {
        ToClassFlag[] values = values();
        for (ToClassFlag sw : values) {
            if (sw.code.equals(code)) {
                return sw;
            }
        }
        return null;
    }

    public static ToClassFlag getByDesc(String desc) {
        ToClassFlag[] values = values();
        for (ToClassFlag sw : values) {
            if (sw.desc.equals(desc)) {
                return sw;
            }
        }
        return null;
    }

    public static Boolean checkCode(String code) {
        ToClassFlag[] values = values();
        for (ToClassFlag sw : values) {
            if (sw.code.equals(code)) {
                return true;
            }
        }
        return false;
    }


    public static Boolean checkDesc(String desc) {
        ToClassFlag[] values = values();
        for (ToClassFlag sw : values) {
            if (sw.desc.equals(desc)) {
                return true;
            }
        }
        return false;
    }
}
